package com.sskj.mine.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.SPUtil;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.SPConfig;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.ui.activity.FeedbackActivity;

public class FeedbackPresenter extends BasePresenter<FeedbackActivity> {
    public void sendRequest(String content, String contact) {
        OkGo.<HttpData<Object>>post(HttpConfig.BASE_URL + HttpConfig.FEEDBACK)
                .params("id", SPUtil.get(SPConfig.ID, ""))
                .params("content", content)
                .params("contactInformation", contact)
                .execute(new JsonCallBack<HttpData<Object>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<Object>> response) {
                        HttpData<Object> httpData = response.body();
                        ToastUtil.showShort(httpData.getMsg());
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.success();
                        }
                    }
                });
    }
}
